//package com.sxz.mall.order.config;
//
//import org.apache.rocketmq.client.exception.MQClientException;
//import org.apache.rocketmq.client.producer.DefaultMQProducer;
//import org.apache.rocketmq.client.producer.SendResult;
//import org.apache.rocketmq.common.message.Message;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class MyRocketMQConfiguration {
//
//    @Value("${rocket.nameserver}")
//    private String nameserver;
//
//    private String orderTopic = "orderTopic";
//
//    public void sendDelayMsg(String orderSN) throws Exception {
//        DefaultMQProducer producer = new DefaultMQProducer("orderGroup2");
//        producer.setNamesrvAddr(nameserver);
//        producer.start();
//        for (int i = 0; i < 100; i++) {
//            Message message = new Message(orderTopic, orderSN.getBytes());
//
//            // 等级：1s 5s 10s 30s 1-10m 20m 30m 1h 2h    18个level
//            message.setDelayTimeLevel(4);
//            SendResult sendResult = producer.send(message);
//
////            System.out.printf("%s%n", sendResult);
//        }
//
//        producer.shutdown();
//    }
//
//}
